package com.pdemo.core.entity;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.pdemo.core.genericdao.BaseEntity;


@Entity
@Table(name="SYSTEM_ROLE")
public class SystemRole extends BaseEntity{
	private static final long serialVersionUID = 4002764969422606577L;
	
	@Column(name="ROLE", length=25)
	private String roleName;
	
	@Column(name="DESCRIPTION", length=50)
	private String roleDesc;
	
	@JsonIgnore
	@ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE}, mappedBy = "roles", fetch = FetchType.EAGER)
	private Set<SystemAdmin> users;

	public String getRoleName() {
		return roleName;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

	public String getRoleDesc() {
		return roleDesc;
	}

	public void setRoleDesc(String roleDesc) {
		this.roleDesc = roleDesc;
	}

	public Set<SystemAdmin> getUsers() {
		return users;
	}

	public void setUsers(Set<SystemAdmin> users) {
		this.users = users;
	}
	
	
	

}
